package cn.edu.nju.freshdelivery.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Component;

import cn.edu.nju.freshdelivery.dao.DishDAO;
import cn.edu.nju.freshdelivery.model.Dish;
import cn.edu.nju.freshdelivery.model.Seller;
import cn.edu.nju.freshdelivery.service.DishService;

@Component
public class DishServiceImpl implements DishService {
	private DishDAO dishDAO;

	public DishDAO getDishDAO() {
		return dishDAO;
	}

	@Resource
	public void setDishDAO(DishDAO dishDAO) {
		this.dishDAO = dishDAO;
	}

	public void add(Dish dish) {
		dishDAO.save(dish);
	}

	public void modify(Dish dish) {
		dishDAO.update(dish);
	}

	public List<Dish> findBySeller(Seller seller) {
		return dishDAO.findBySeller(seller);
	}

	public Dish findById(int id) {
		return dishDAO.findById(id);
	}

}
